<script>
	import {
		request
	} from '@/utils/request.js'
	import {
		storageData
	} from '@/utils/storageData.js'
	export default {
		globalData: {
			wechatOpenId: '',
			unionId: '',
			idNo: '',
			loginUser: {}
		},
		onLaunch: function() {
			console.log('App Launch')
			// uni.clearStorageSync()
			const options = uni.getLaunchOptionsSync()
			console.log(options)
			const shareUc = options.query.shareUc
			console.log(shareUc)
			
			// 获取微信用户的WechatOpenId
			const $this = this
			$this.globalData.idNo = new Date().getTime() + ''
			
			// wx.getUserInfo({
			// 	success(res) {
			// 		wx.login({
			// 			success(e) {
			// 				request.postJson('/account/wxMinProgramLogin', {
			// 					code: e.code,
			// 					nickName: res.userInfo.nickName,
			// 					avatarUrl: res.userInfo.avatarUrl
			// 				}).then(lgres => {
			// 					storageData.saveLoginUser({
			// 						accessToken: lgres.result
			// 					})
			// 					request.get('/account/info').then(info => {
			// 						if (info.result) {
			// 							let obj = Object.assign({
			// 								accessToken: lgres.result
			// 							}, info.result)
			// 							storageData.saveLoginUser(obj)
			// 						} else {
			// 							uni.showToast({
			// 								title: '登录失败',
			// 								icon: 'none'
			// 							})
			// 						}
			// 					})
			// 				})
			// 			}
			// 		})
			// 	}
			// })
			
		},
		onHide() {
			const data = {}
			console.log('App Hide')
		},
		onShareAppMessage(res) {
			const userInfo = storageData.getLoginUser()
			if (res.from === 'button') {
				// 来自页面内分享按钮
				console.log(res.target);
			}
			return {
				title: '小奕口算：学习好帮手',
				path: '/pages/index/index?shareUc=' + userInfo.userCode,
				mpId: 'wxcbbe1a868c5c3c3c', //此处配置微信小程序的AppId
				imageUrl: 'https://www.hzif.cn/mathematics-attach/share.png'
			}
		},
		onShareTimeline(res) {
			const userInfo = storageData.getLoginUser()
			return {
				title: '小奕口算：学习好帮手',
				path: '/pages/index/index?shareUc=' + userInfo.userCode,
				mpId: 'wxcbbe1a868c5c3c3c', //此处配置微信小程序的AppId
				imageUrl: 'https://www.hzif.cn/mathematics-attach/share.png'
			}
		},
		onShow: function() {
			console.log('App Show')
		}
	}
</script>
<style lang="scss">
	@import "@/uni_modules/uview-plus/index.scss";
</style>
<style lang="scss">
	@import url("/static/css/animate.min.css");

	@font-face {
		font-family: 'eryaxinhei';
		src: url("https://www.hzif.cn/mathematics-attach/eryaxindahei.TTF") format("truetype");
	}

	/*每个页面公共css */
	page {
		width: 100%;
		height: 100%;
		font-size: 14px;
		color: #333333;
	}

	uni-app,
	uni-page,
	uni-page-wrapper,
	uni-page-body {
		height: 100%;
	}

	.pagebox {
		padding: 0 40rpx;
		position: relative;
		z-index: 4;
		top: 160rpx;
	}

	.page_bg_img {
		position: absolute;
		z-index: 2;
		height: 100vh;
		width: 100%;
	}

	.page_wrapper {
		// width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		/* background: linear-gradient(to bottom, #d9e6f2 0%, #f5f5dc 100%); /* 渐变从浅蓝色到米色 */

		.bottom_btns_block {
			width: 100%;
			margin-top: 50rpx;
			// height: calc(100upx + env(safe-area-inset-bottom) / 2);
			// padding-bottom: calc(env(safe-area-inset-bottom) / 2);
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.my-anim {
			animation-duration: 2s;
			animation-delay: 0s;
			/* 下面这个循环
			animation-iteration-count: infinite; */
		}



	}

	.page_bg {
		// background-color: #EBEEF5!important;
	}

	.page_sub_title {
		font-size: 17px;
		font-weight: 500;
		color: #333333;
		height: 60px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.fcz_btn {
		width: 90%;
		height: 40px;
		color: white;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #67C23A;
		border-radius: 5px;
	}

	.green_btn {
		background: rgb(66, 185, 131);
		color: white;
	}

	.top_line {
		border-top: 1px solid #e2e2e2;
	}

	.bottom_line {
		border-bottom: 1px solid #e2e2e2;
	}

	.disabled_btn {
		background-color: darkgray !important;
	}

	/* 三角形 */
	.triangle {
		width: 0;
		height: 0;
		border-left: 12px solid transparent;
		border-right: 12px solid transparent;
		border-bottom: 24px solid red;
	}

	/* 圆形*/
	.circle {
		width: 100px;
		height: 100px;
		border-radius: 50%;
		background-color: red;
	}

	/*正方形*/
	.square {
		width: 100px;
		height: 100px;
		background-color: red;
	}

	/*菱形--------------------------start*/
	.diamond {
		width: 100px;
		height: 100px;
		background-color: red;
		transform: rotate(45deg);
		margin-top: 50px;
		/* 为了居中显示 */
		transform-origin: center;
	}

	/* 如果你希望菱形在视觉上保持水平，你可以包裹在另一个元素中，并旋转回来 */
	.diamond-container {
		position: relative;
		width: 141px;
		/* 对角线长度，通过 Pythagorean theorem 计算得到 */
		height: 141px;
		margin: 50px auto;
		/* 居中显示 */
		transform: rotate(-45deg);
	}

	.diamond-container .diamond {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: rotate(45deg) translate(-50%, -50%);
	}

	/*菱形--------------------------end*/

	/*星形*/
	.star {
		width: 0;
		height: 0;
		border-right: 100px solid transparent;
		border-bottom: 70px solid red;
		border-left: 100px solid transparent;
		position: relative;
		transform: rotate(35deg);
		margin: 50px auto;
	}

	/*
	tabbar : select : #36ab60
	tabbar : no select : #8a8a8a
	*/
</style>